<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('俱乐部列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>俱乐部名称：</label>
                                <input type="text" name="clubName"/>
                            </li>
                            <li>
                                <label>地址：</label>
                                <input type="text" name="address"/>
                            </li>
                            <li>
                                <label>城市：</label>
                                <input type="text" name="city"/>
                            </li>
                            <li>
                                <label>区：</label>
                                <input type="text" name="dist"/>
                            </li>
                            <li>
                                <label>省份：</label>
                                <input type="text" name="prov"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="club:club:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="club:club:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.addphoto()" shiro:hasPermission="club:club:edit">
                    <i class="fa fa-edit"></i> 增加图片
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="club:club:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="club:club:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('club:club:edit')}]];
        var removeFlag = [[${@permission.hasPermi('club:club:remove')}]];
        var statusDatas = [[${@dict.getType('club_status')}]];
        var weaponsDatas = [[${@dict.getType('club_jian_type')}]];
        var clubstatusDatas = [[${@dict.getType('club_status')}]];
        var prefix = ctx + "club/club";
        var photoprefix = ctx + "club/photo";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                addphotoUrl: photoprefix + "/add/{id}",
                modalName: "俱乐部",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'clubId',
                    title: '俱乐部id',
                    visible: false
                },
                {
                    field: 'clubName',
                    title: '俱乐部名称'
                },
                {
                    field: 'leader',
                    title: '负责人'
                },
                {
                    field: 'phone',
                    title: '联系电话'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'logoimg',
                    title: 'LOGO'
                },
                {
                    field: 'iswifi',
                    title: '有无WIFI热点'
                },
                {
                    field: 'wifi',
                    title: 'WIFI名称/密码'
                },
                {
                    field: 'city',
                    title: '城市'
                },
                {
                    field: 'dist',
                    title: '区'
                },
                {
                    field: 'prov',
                    title: '省份'
                },
                {
                    field: 'weapons',
                    title: '剑种',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(weaponsDatas, value);
                    }
                },
                {
                    field: 'StripsQty',
                    title: '总剑道数量'
                },
                {
                    field: 'InstallStripsQty',
                    title: '安装剑道数'
                },
                {
                    field: 'clubstatus',
                    title: '可用状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(clubstatusDatas, value);
                    }
                },
                {
                    field: 'sitearea',
                    title: '场馆面积'
                },
                {
                    field: 'traineeQty',
                    title: '学员数量'
                },
                {
                    field: 'courseQty',
                    title: '发布课程数'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.clubId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.clubId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.addphoto(\'' + row.clubId + '\')"><i class="fa fa-edit"></i>增加图片</a> ');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>